package edu.sctu.wangfuxin.day20150628.until;

/**
 * Created by user06 on 2015/6/28.
 */

import edu.sctu.wangfuxin.day20150628.data.GetJsonData;
import edu.sctu.wangfuxin.day20150628.data.PriceData;

/**
 * 线程处理类
 */
public class ThreadUtil {
    /**
     * 启动线程
     */
    public void startThread(String urlpath, String path0, String path, String param, String path1) {
        new Thread() {
            public void run() {
                super.run();
                try {
                    if (new FileUtil().crateNewFile(path0)) {
                        System.out.println("文件夹创建成功！请稍后......");
                        Thread.sleep(5000);
                        SerializableUtil serializableUtil = new SerializableUtil(path1);
                        PriceUtil priceUtil = new PriceUtil();
                        serializableUtil.serializableClass(new JsonUtil().analyzeJson(new GetJsonData().getJsonData(urlpath, path, param)));
                        priceUtil.priceDeth(new PriceData(serializableUtil).setPricData());
                    } else {
                        System.out.println("该文件夹已存在！请检查！");
                    }
                } catch (InterruptedException e) {
                    e.printStackTrace();//
                }//
            }
        }.start();
    }
}
